package com.next.core.util;

import java.util.concurrent.ThreadLocalRandom;

public class RandomUtil {

	public static int[] shuffleArray(int[] array) {

		for (int i = 0; i < array.length; i++) {
			int randomPosition = nextInt(array.length);
			int temp = array[i];
			array[i] = array[randomPosition];
			array[randomPosition] = temp;
		}

		return array;
	}

	public static int nextInt(int bound) {
		return ThreadLocalRandom.current().nextInt(bound);
	}
}
